package wc.model.component;

import java.util.*;

import wc.model.component.roomcomponent.RoomComponent;
import wc.model.component.roomcomponent.StoreComponent;
import wc.model.grid.*;

public abstract class MallRoom extends MallComponent {

	protected TileGrid<RoomComponent> roomComponents = null;
	protected List<RoomComponent> mustPlaceComponents = null;
	protected static int minimumWidth = 0;
	protected static int minimumHeight = 0;
	
	public MallRoom(TileGrid<Component> relativeLocations, TileGrid<RoomComponent> roomComponents) {
		super(relativeLocations);
		if(relativeLocations.getWidth() != roomComponents.getWidth() || relativeLocations.getHeight() != roomComponents.getHeight()) {
			try {
				throw new Exception();
			} catch (Exception e) {
				System.out.println("Dimensions don't match");
				e.printStackTrace();
			}
		}
		if(relativeLocations.getWidth() < minimumWidth || relativeLocations.getHeight() < minimumHeight) {
			try {
				throw new Exception();
			} catch (Exception e) {
				System.out.println("Room too small");
				e.printStackTrace();
			}
		}
		this.roomComponents = roomComponents;
		mustPlaceComponents = new ArrayList<RoomComponent>();
	}
	
	public boolean addRoomComponent (int x, int y, RoomComponent component) {
		return roomComponents.addComponent(x, y, component);
	}
	
	public List<RoomComponent> getMustPlaceComponents() {
		return mustPlaceComponents;
	}
	
	public TileGrid<RoomComponent> getTileGrid() {
		return roomComponents;
	}
}
